package com.pan.creational.factory;

import com.pan.creational.factory.impl.Circle;
import com.pan.creational.factory.impl.Rectangle;
import com.pan.creational.factory.impl.Square;

public class ShapeFactory {

    public Shape getShape(Type type){
        if (type == Type.CIRCLE){
            return new Circle();
        }else if (type == Type.RECTANGLE){
            return new Rectangle();
        } else if (type == Type.SQUARE) {
            return new Square();
        }else {
            throw new RuntimeException("error type: "+type);
        }
    }
}
